package com.jesper.service;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.jesper.mapper.UserMapper;
import com.jesper.model.User;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class UserService extends ServiceImpl<UserMapper, User> {
    @Autowired
    UserMapper userMapper;

    public String getByName(String username) {
        String password = userMapper.selectPasswordByName1(username);
        return password;
    }

    public User getUserByName(String username) {
        User user = new User();
        user.setUserName(username);
        user.setPassword(userMapper.selectPasswordByName1(username));
        return user;
    }

    public int selectIsName(User user) {
        return this.userMapper.selectIsName(user);
    }

    public String selectPasswordByName(User user) {
        return this.userMapper.selectPasswordByName(user);
    }

    public User selectByNameAndPwd(User user) {
        return this.userMapper.selectByNameAndPwd(user);
    }

    public Integer getRoleByName(String username) {
        return this.baseMapper.getRoleByName(username);
    }

}
